* NGOs and the effectiveness of interventions
* Usmani, Jeuland, Pattanayak

*******************************************************************

clear all

global main = "C:/Desktop/Main folder - public/" // set main folder location

global code = "${main}code/" // folder with code
global data = "${main}data/" // folder with data
global output = "${main}output/" // folder with temporary output
global results = "${main}results/" // folder with exported results

capture log close // log file
log using "${output}ngo_log.txt", replace text 

*******************************************************************

* Data cleaning and panel creation

// Note:	Raw survey data unavailable due to anonymity concerns.	
//			All data-cleaning DO files are provided for reference in this subsection.
//			See also: ngo_log_cleaning.txt (log file for data cleaning)

/*

// Clean baseline (Round 0)
run "${code}clean_r0_baseline.do"

// Clean follow-up 1 (Round 1)
run "${code}clean_r1_followup.do"

// Clean follow-up 2 (Round 2)
run "${code}clean_r2_followup.do"

// Combine rounds and create household-level panel
run "${code}merge_r0_r1_r2.do"

*/

*******************************************************************

* Summary statistics

// Table 1: Post-match balance (Census 2001)
do "${code}table_postmatch_community_balance.do"

// Table 2: Descriptive statistics
do "${code}table_descriptive_statistics.do"

// Appendix Tables D2 and D3: Cross-sectional balance (Census 2011) and pre-trends (Census 2001--2011)
do "${code}table_pretrends_crossec_balance.do"

// Footnote 23: Experiencing stove problems over time
do "${code}analysis_stove_maintenance.do"

*******************************************************************

* Analysis tables

// Table 3: Purchase rates of intervention stoves
do "${code}analysis_intervention_purchase.do"

// Table 4: Intervention stove adoption and use over time
do "${code}analysis_continued_adoption_use.do"

// Table 5: Impact on improved stoves
do "${code}analysis_improved_stoves.do"

// Table 6: Impact on energy-use patterns
do "${code}analysis_impact_heterogeneity.do"

// Appendix Table D1 and Appendix Figure C1: Propensity score matching results
do "${code}analysis_psm.do"

// Appendix Table D4: Baseline ICS ownership does not predict subsequent purchase
do "${code}analysis_baseline_improved_predict_purchase.do"

// Appendix Table D5: Impact on fuel collection time for all fuels and traditional fuels
do "${code}analysis_impact_fuel_collection.do"

*******************************************************************

* Analysis figures

// Figure 2: Impact of intervention on purchase rates
do "${code}figure_purchase_rates.do"

// Figure 3: Impact on continued adoption/use
do "${code}figure_continued_adoption_use.do"

// Appendix Figure C2: Randomization inference
do "${code}figure_randomization_inference.do"

// Figure 4 and Appendix Table F1: Bayesian estimation
do "${code}figure_bayesian_estimation.do"

// Appendix Figure E1: Redfining NGO variable (linear)
do "${code}figure_redefining_ngo_variable_linear.do"

// Appendix Figure E2: Redfining NGO variable (quadratic)
do "${code}figure_redefining_ngo_variable_quadratic.do"

*******************************************************************

capture log close
* END
